﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace MDIDemo.Windows
{
    public partial class frmViewTaiKhoan : DevExpress.XtraEditors.XtraForm
    {
        bool isSupplier = false;
        string sErr = "";
        DataRow returnRow = null;

        public DataRow ReturnRow
        {
            get { return returnRow; }
            set { returnRow = value; }
        }
        public bool IsSupplier
        {
            get { return isSupplier; }
            set { isSupplier = value; }
        }
        public frmViewTaiKhoan()
        {
            InitializeComponent();
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void btnDongY_Click(object sender, EventArgs e)
        {
            if (gridView.CurrentRow != null)
            {
                if (gridView.CurrentRow.DataRow is DataRowView)
                {
                    returnRow = ((DataRowView)gridView.CurrentRow.DataRow).Row;
                    DialogResult = System.Windows.Forms.DialogResult.OK;
                    Close();
                }
            }
        }

        private void btnLamTuoi_Click(object sender, EventArgs e)
        {
            LoadTaiKhoan();
        }

        private void frmViewKhachHang_Load(object sender, EventArgs e)
        {
            LoadTaiKhoan();
        }

        private void LoadTaiKhoan()
        {
            BUS.ACC_SYSControl ctr = new BUS.ACC_SYSControl();
            gridView.DataSource = ctr.GetAll(ref sErr);
        }

       

        private void gridView_RowDoubleClick(object sender, Janus.Windows.GridEX.RowActionEventArgs e)
        {
            if (e.Row.DataRow is DataRowView)
            {
                returnRow = ((DataRowView)e.Row.DataRow).Row;
                DialogResult = System.Windows.Forms.DialogResult.OK;
                Close();
            }
        }
    }
}